<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="http://unpkg.com/vue@next"></script>
</head>

<body>
    <div id="root"></div>
</body>
<script>
    let app = Vue.createApp({
        //之前计算属性写法
        // computed: {
        //     aa() {
        //         return this.a + this.b
        //     },
        // },
        setup() {
            const { ref, computed } = Vue
            const count = ref(0)
            const handleChange = () => {
                count.value += 1
            }
            // count2 = computed(() => {
            //     return count.value += 2
            // })
            count2 = computed({
                get: () => {
                    return count.value += 2
                },
                set: () => {
                    count.value = 5
                }
            })
            return { count, handleChange, count2 }
        },
        template: '<div @click=handleChange>{{count}}{{count2}}</div>',
        methods: {

        }
    })
    app.mount('#root')
</script>

</html>